package com.market2.utils.converter.impl;

import com.market2.dto.NegociationDto;
import com.market2.model.Negociation;
import com.market2.model.NegociationEnchere;
import com.market2.model.NegociationPrixFix;
import com.market2.utils.converter.Converter;

public class NegociationConverter extends Converter
{
	@SuppressWarnings("unchecked") @Override 
	public NegociationDto convertTo(Object source)
	{
		System.out.println("NegociationConverter.convertTo");
		if(source instanceof NegociationPrixFix) {
			return (new NegociationPrixFixConverter()).convertTo(source);
		}
		
		if(source instanceof NegociationEnchere) {
			return (new NegociationEnchereConverter()).convertTo(source);
		}
		
		return null;
	}

	@SuppressWarnings("unchecked") @Override
	public Negociation convertFrom(Object source)
	{
		System.out.println("NegociationConverter.convertFrom");
		if(source instanceof NegociationPrixFix) {
			return (new NegociationPrixFixConverter()).convertFrom(source);
		}
		
		if(source instanceof NegociationEnchere) {
			return (new NegociationEnchereConverter()).convertFrom(source);
		}
		
		return null;
	}
}
